package com.dushibao.manage.uploadServer;

import com.alibaba.fastjson2.JSON;
import com.dushibao.service.UploadServerService;
import com.dushibao.service.impl.UploadServerServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.List;

@WebServlet("/uploadServer/delete")
public class DeleteServlet extends HttpServlet {
    UploadServerService uploadServerService = new UploadServerServiceImpl();

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        BufferedReader bw = req.getReader();
        String json = bw.readLine();
        List<Long> ids = JSON.parseArray(json, Long.class);

        Integer ret = uploadServerService.deleteById(ids);

        resp.getWriter().write(ret.toString());

    }
}
